
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import play.Application;
import play.Logger;
import play.GlobalSettings;

public class Global extends GlobalSettings {
protected ApplicationContext ctx;

@Override
public void onStart(Application app)
{
    String springConfigurationName = "components.xml";
    ctx = new ClassPathXmlApplicationContext(springConfigurationName);
    Logger.debug("Loading spring configuration: {}", springConfigurationName);
}

@Override
public <A> A getControllerInstance(Class<A> clazz)
{
    return ctx.getBean(clazz);
}
}